# Contributor: Raed Rizqie <raed.rizqie@gmail.com>

_realname=numpydoc
pkgbase=mingw-w64-python-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-python-${_realname}
pkgver=1.8.0
pkgrel=1
pkgdesc='Sphinx extensions for Numpy (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
license=('spdx:BSD-2-Clause')
url='https://numpydoc.readthedocs.io/'
msys2_repository_url="https://github.com/numpy/numpydoc"
msys2_references=(
  'purl: pkg:pypi/numpydoc'
)
depends=(
    "${MINGW_PACKAGE_PREFIX}-python-jinja"
    "${MINGW_PACKAGE_PREFIX}-python-sphinx"
    "${MINGW_PACKAGE_PREFIX}-python-tabulate")
makedepends=(
    "${MINGW_PACKAGE_PREFIX}-python-build"
    "${MINGW_PACKAGE_PREFIX}-python-installer"
    "${MINGW_PACKAGE_PREFIX}-python-setuptools")
options=(!strip)
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('022390ab7464a44f8737f79f8b31ce1d3cfa4b4af79ccaa1aac5e8368db587fb')

prepare() {
  rm -rf "${srcdir}/python-build-${MSYSTEM}" | true
  cp -r "${srcdir}/${_realname}-${pkgver}" "${srcdir}/python-build-${MSYSTEM}"
}

build() {
  cd "${srcdir}/python-build-${MSYSTEM}"
  ${MINGW_PREFIX}/bin/python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd "${srcdir}/python-build-${MSYSTEM}"
  MSYS2_ARG_CONV_EXCL="--prefix=" \
    ${MINGW_PREFIX}/bin/python -m installer --prefix=${MINGW_PREFIX} \
    --destdir="${pkgdir}" dist/*.whl

  install -Dm644 LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE.txt"
}
